package cn.dujc.superkid.bean;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.List;

/**
 * @author du
 * date 2018/7/29 下午1:18
 */
public class LearningProcessResult implements Parcelable{
    /**
     * grade_list : [{"id":1,"gname":"一年级"},{"id":2,"gname":"二年级"}]
     * grade_name : 一年级
     * course : [{"knowledge_name":"应用题","knowlist":[{"id":422,"title":"摸彩球","is_learning":2}]}]
     */

    private String grade_name;//当前年级
    private List<GradeListEntity> grade_list;//所有年级列表
    private List<CourseEntity> course;//知识点及课程列表

    public String getGrade_name() { return grade_name;}

    public void setGrade_name(String grade_name) { this.grade_name = grade_name;}

    public List<GradeListEntity> getGrade_list() { return grade_list;}

    public void setGrade_list(List<GradeListEntity> grade_list) { this.grade_list = grade_list;}

    public List<CourseEntity> getCourse() { return course;}

    public void setCourse(List<CourseEntity> course) { this.course = course;}

    @Override
    public int describeContents() { return 0; }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.grade_name);
        dest.writeTypedList(this.grade_list);
        dest.writeTypedList(this.course);
    }

    public LearningProcessResult() {}

    protected LearningProcessResult(Parcel in) {
        this.grade_name = in.readString();
        this.grade_list = in.createTypedArrayList(GradeListEntity.CREATOR);
        this.course = in.createTypedArrayList(CourseEntity.CREATOR);
    }

    public static final Creator<LearningProcessResult> CREATOR = new Creator<LearningProcessResult>() {
        @Override
        public LearningProcessResult createFromParcel(Parcel source) {return new LearningProcessResult(source);}

        @Override
        public LearningProcessResult[] newArray(int size) {return new LearningProcessResult[size];}
    };

    public static class GradeListEntity implements Parcelable {
        /**
         * id : 1
         * gname : 一年级
         */

        private String id;//年级id
        private String gname;//年级名

        public String getId() { return id;}

        public void setId(String id) { this.id = id;}

        public String getGname() { return gname;}

        public void setGname(String gname) { this.gname = gname;}

        @Override
        public int describeContents() { return 0; }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(this.id);
            dest.writeString(this.gname);
        }

        public GradeListEntity() {}

        protected GradeListEntity(Parcel in) {
            this.id = in.readString();
            this.gname = in.readString();
        }

        public static final Creator<GradeListEntity> CREATOR = new Creator<GradeListEntity>() {
            @Override
            public GradeListEntity createFromParcel(Parcel source) {return new GradeListEntity(source);}

            @Override
            public GradeListEntity[] newArray(int size) {return new GradeListEntity[size];}
        };
    }

    public static class CourseEntity implements Parcelable{
        /**
         * knowledge_name : 应用题
         * knowlist : [{"id":422,"title":"摸彩球","is_learning":2}]
         */

        private String knowledge_name;//知识点名
        private List<KnowlistEntity> knowlist;

        public String getKnowledge_name() { return knowledge_name;}

        public void setKnowledge_name(String knowledge_name) { this.knowledge_name = knowledge_name;}

        public List<KnowlistEntity> getKnowlist() { return knowlist;}

        public void setKnowlist(List<KnowlistEntity> knowlist) { this.knowlist = knowlist;}

        @Override
        public int describeContents() { return 0; }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(this.knowledge_name);
            dest.writeTypedList(this.knowlist);
        }

        public CourseEntity() {}

        protected CourseEntity(Parcel in) {
            this.knowledge_name = in.readString();
            this.knowlist = in.createTypedArrayList(KnowlistEntity.CREATOR);
        }

        public static final Creator<CourseEntity> CREATOR = new Creator<CourseEntity>() {
            @Override
            public CourseEntity createFromParcel(Parcel source) {return new CourseEntity(source);}

            @Override
            public CourseEntity[] newArray(int size) {return new CourseEntity[size];}
        };
    }

    public static class KnowlistEntity implements Parcelable{
        /**
         * id : 422
         * title : 摸彩球
         * is_learning : 2
         */

        private String id;//课程id
        private String title;//课程标题
        private String is_learning;//是否学习（1-未学习，2-已学习）

        public String getId() { return id;}

        public void setId(String id) { this.id = id;}

        public String getTitle() { return title;}

        public void setTitle(String title) { this.title = title;}

        public String getIs_learning() { return is_learning;}

        public void setIs_learning(String is_learning) { this.is_learning = is_learning;}

        @Override
        public int describeContents() { return 0; }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(this.id);
            dest.writeString(this.title);
            dest.writeString(this.is_learning);
        }

        public KnowlistEntity() {}

        protected KnowlistEntity(Parcel in) {
            this.id = in.readString();
            this.title = in.readString();
            this.is_learning = in.readString();
        }

        public static final Creator<KnowlistEntity> CREATOR = new Creator<KnowlistEntity>() {
            @Override
            public KnowlistEntity createFromParcel(Parcel source) {return new KnowlistEntity(source);}

            @Override
            public KnowlistEntity[] newArray(int size) {return new KnowlistEntity[size];}
        };
    }

}
